Organization: Bundesamt fuer Sicherheit in der Informationstechnik
Date: Wed, 13 Mar 1996 13:12:49 GMT
Second attempt to post this, I fear the first text stayed local only:
Hello,
I got trouble with Borland C++ v3.1 for DOS running under OS/2 in a DOS BOX with the following piece of code:
-- snip ---
printf("Memory avail: %li Bytes\n",farcoreleft);
picture=(unsigned char huge*)farmalloc(483000);
if (picture==NULL) {
printf("Not enough memory for picture buffer #1.\n"); exit(8);
}
printf("Memory avail after buffer #1: %li Bytes\n",farcoreleft);
-- snap ---
Compiler setting is to "HUGE". But farmalloc (and farcalloc, too) won't get memory from the far heap (Under OS/2 with max settings around 500 MByte!). Instead it get memory from the near heap, which size is limited to size of DOS main memory. Thus a 483000 Bytes block doesn't fit, but 480000 does. I tested it under plain DOS, there are some bytes more memory available and it worked.
If farmalloc would get the DOS memory first, and then the far memory - OK, I could live with it. But unfortunately farmalloc NEVER gets any memory from my big far heap.